Skip to content

feat: Add toPrestoTypeSql() for Presto SQL type formatting (#16876)#16876

Closed
mbasmanova wants to merge 1 commit intofacebookincubator:mainfrom
mbasmanova:export-D97605331
Closed

feat: Add toPrestoTypeSql() for Presto SQL type formatting (#16876)#16876
mbasmanova wants to merge 1 commit intofacebookincubator:mainfrom
mbasmanova:export-D97605331

Conversation

@mbasmanova
Copy link
Contributor

@mbasmanova mbasmanova commented Mar 21, 2026

Summary:

Move toTypeSql() from velox/exec/fuzzer/PrestoSql (test utility) to
velox/functions/prestosql/types/PrestoTypeSql so it can be used from
production code. Rename to toPrestoTypeSql() to clarify dialect.

Fix a number of issues in the original implementation:

  • Custom types (IPPREFIX, BINGTILE) were expanded into their underlying
    ROW structure instead of using type->name(). Use typeid check to
    detect custom types implemented on top of ARRAY, MAP, or ROW.
  • Parameterized types (TDIGEST(DOUBLE), DECIMAL(10, 2)) were not
    handled. Use type->parameters() to format them generically.
  • ROW field names with spaces or special characters were not quoted.
    Use std::quoted() with Presto SQL double-quote escaping.
  • Unnamed ROW fields produced extra spaces.

Also add VELOX_DECLARE_ENUM_NAME for TypeParameterKind.

Needed for SHOW CREATE TABLE support in Axiom.

Reviewed By: xiaoxmeng

Differential Revision: D97605331

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 21, 2026
@meta-codesync
Copy link

meta-codesync bot commented Mar 21, 2026

@mbasmanova has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97605331.

@netlify
Copy link

netlify bot commented Mar 21, 2026

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 77fe34d
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/69bf1f02960c8700084b5d6f

…ncubator#16876)

Summary:

Move toTypeSql() from velox/exec/fuzzer/PrestoSql (test utility) to
velox/functions/prestosql/types/PrestoTypeSql so it can be used from
production code. Rename to toPrestoTypeSql() to clarify dialect.

Fix a number of issues in the original implementation:
- Custom types (IPPREFIX, BINGTILE) were expanded into their underlying
  ROW structure instead of using type->name(). Use typeid check to
  detect custom types implemented on top of ARRAY, MAP, or ROW.
- Parameterized types (TDIGEST(DOUBLE), DECIMAL(10, 2)) were not
  handled. Use type->parameters() to format them generically.
- ROW field names with spaces or special characters were not quoted.
  Use std::quoted() with Presto SQL double-quote escaping.
- Unnamed ROW fields produced extra spaces.

Also add VELOX_DECLARE_ENUM_NAME for TypeParameterKind.

Needed for SHOW CREATE TABLE support in Axiom.

Reviewed By: xiaoxmeng

Differential Revision: D97605331
@meta-codesync meta-codesync bot changed the title feat: Add toPrestoTypeSql() for Presto SQL type formatting feat: Add toPrestoTypeSql() for Presto SQL type formatting (#16876) Mar 21, 2026
@meta-codesync meta-codesync bot closed this in cf9ee6b Mar 22, 2026
@meta-codesync
Copy link

meta-codesync bot commented Mar 22, 2026

This pull request has been merged in cf9ee6b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants